package com.xqzgj.system.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xqzgj.common.core.controller.BaseController;
import com.xqzgj.common.core.domain.AjaxResult;
import com.xqzgj.common.core.page.TableDataInfo;
import com.xqzgj.system.domain.StockInfo;
import com.xqzgj.system.service.IStockWarningService;

/**
 * 库存预警Controller
 * 
 * @author xqzgj
 */
@RestController
@RequestMapping("/system/stock/warning")
public class StockWarningController extends BaseController
{
    @Autowired
    private IStockWarningService stockWarningService;

    /**
     * 查询库存预警数量
     */
    @PreAuthorize("@ss.hasPermi('system:stock:list')")
    @GetMapping("/count")
    public AjaxResult getWarningCount()
    {
        return AjaxResult.success(stockWarningService.selectWarningCount());
    }

    /**
     * 查询库存预警列表
     */
    @PreAuthorize("@ss.hasPermi('system:stock:list')")
    @GetMapping("/list")
    public TableDataInfo list(StockInfo stockInfo)
    {
        startPage();
        List<StockInfo> list = stockWarningService.selectWarningList(stockInfo);
        return getDataTable(list);
    }
}